﻿<!DOCTYPE html>
<html ng-app="eventModule">
	<head>
		<meta charset="utf-8">
		<script src="angular.min.js"></script>
		<style>
			#parent{
				width:350px;
				height:250px;
				border:3px solid #ccc;
			}
			#child{
				width:300px;
				height:200px;
				border:3px solid #ccc;
				margin:10px auto;
			}
		</style>
	</head>
	<body>
		<div id="parent" ng-controller="ParentController">
			<div id="child" ng-controller="ChildController">
				<button ng-click="postEvent()">Emit</button>
			</div>
		</div>
		<script>
			var app = angular.module('eventModule',[])
			app.controller('ParentController',
				function($scope){
					$scope.$on("infoEvent",function(event,data){
						console.log("接收到子文件");
						console.log(data);
					});
				});
			app.controller('ChildController',
				function($scope){
					$scope.$emit("infoEvent",{name:'Jane',age:23});
				});
			
		</script>
	</body>
</html>
